﻿using System;
using Microsoft.AspNetCore.Mvc;
using MsgService.Model;
using Newtonsoft.Json.Linq;

namespace MsgService.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class SMSController : ControllerBase
    {
        [HttpPost(nameof(Send_XM))]
        public void Send_XM(SendSMSRequst sendSMSRequst)
        {
            Console.WriteLine($"通过小米短信接口,向手机号：{sendSMSRequst.PhoneNum}发送短信，短信内容：{sendSMSRequst.Msg}");
        }

        [HttpPost(nameof(Send_LX))]
        public void Send_LX(dynamic request)
        {
            Console.WriteLine($"通过联想短信接口，向手机号：{request.PhoneNum}发送短信，短信内容：{request.Msg}");
        }

        [HttpPost(nameof(Send_HW))]
        public void Send_HW(JObject jObject)
        {
            var request = jObject.ToObject<SendSMSRequst>();

            Console.WriteLine($"通过华为短信接口，向手机号：{request.PhoneNum}发送短信，短信内容：{request.Msg}");
        }
    }
}